# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=promu
pkgver=0.17.0
pkgrel=0
pkgdesc="Prometheus Utility Tool"
url="https://github.com/prometheus/promu"
arch="all"
license="Apache-2.0"
makedepends="go"
source="https://github.com/prometheus/promu/archive/v$pkgver/promu-$pkgver.tar.gz
	default-config-no-static.patch
	test-tarball-prefix.patch
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	local _goldflags="
		-X github.com/prometheus/common/version.Version=$pkgver
		-X github.com/prometheus/common/version.Branch=non-git
		"

	go build -v -ldflags "$_goldflags"
}

check() {
	go test -v -skip 'TestPromuBuild_ExtLDFlags|TestPromuCrossbuild' ./...
}

package() {
	install -Dvm755 promu -t "$pkgdir"/usr/bin/
}

sha512sums="
8265fd0e9f37624dc1e6abdef87475b5116a7e7af260fc83bc3cda98409af78d4db9d409cd404e251cbf81c124e6a6cd5ab70eef6845ec33048da4937eac01dd  promu-0.17.0.tar.gz
9947edb3a8c6d1964f6e4a233d3919b14fa3622e390131d938096464c0b15597bd3bf0a92df807d009b9864c832e1960e2d976a5b152deb0c914e8b99f29b2d3  default-config-no-static.patch
e03189d979087f43e8f27da5ee158f93bf5d3d22b7b95b41f3a4152bf4ba596c176c79b98ce92ba310fd58b06ad1912b43f3fbdb0297610a6539131920d665c4  test-tarball-prefix.patch
"
